package com.whacos.common.controller;

import com.whacos.common.shiro.ShiroUtils;
import com.whacos.modules.system.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;

/**
 * @author xiongdun
 * @description BaseController
 * @since 2018/11/17 17:11
 */
@Controller
@Slf4j
public class BaseController {

    /**
     * 获取当前登陆用户信息
     * @return
     */
	public SysUser getUser() {
		return ShiroUtils.getUser();
	}

    /**
     * 获取当前登陆用户Id
     * @return
     */
	public Long getUserId() {
		return getUser().getId();
	}
    /**
     * 获取当前登陆用户名称
     * @return
     */
	public String getUsername() {
		return getUser().getUsername();
	}
}